Skip to content

Private inputs example + dapp quickstart doc#87

Open
iamalwaysuncomfortable wants to merge 21 commits into
masterfrom
examples/private-inputs-example
Open

Private inputs example + dapp quickstart doc#87
iamalwaysuncomfortable wants to merge 21 commits into
masterfrom
examples/private-inputs-example

Conversation

@iamalwaysuncomfortable

@iamalwaysuncomfortable iamalwaysuncomfortable commented May 12, 2026

Copy link
Copy Markdown
Member

Description

Adds a Private Inputs demo under examples/react-app/src/components/functions/PrivateInputs.tsx exercising the spec's new wallet-adapter privacy features end-to-end:

  • Per-program recordAccess grants (program / record / field narrowing) composed via a structured form, with a JSON preview for copy-paste into a real dapp.
  • Connect-time readAddress and viewKeyExposure toggles, including the readAddress: falsedecryptPermission: NoDecrypt interlock.
  • Function inputs auto-parsed from the program source. Each slot picks its own mode:
    • Primitive — literal, {type:"address"}, or {type:"viewKey"} (allowed per spec for address/group/scalar/field).
    • Record — plaintext, pin-by-uid from a fetched-records dropdown, or auto-select by RecordFilters.
  • Read-only records inspector to verify the grant matrix (which envelope metadata + recordView.fields survive per the configured grant).

Docs

Concise dapp-implementor guide for these features:

dapp-privacy-quickstart.md

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 📚 Documentation update

Testing

  • pnpm --filter react-app-example build succeeds.
  • pnpm lint clean.
  • Manually tested against a local Shield extension build supporting the new options: configure a narrowed recordAccess grant, apply + reconnect, fetch records (verified envelope-metadata stripping matches the spec's matrix), execute credits.aleo/transfer_private via both uid pinning and RecordFilters, verify the readAddress: false interlock against decryptPermission.

Update InputRequest type to include new request kinds and clarify wallet behavior. Revise permission model and fulfillment flow for better user input handling.

Signed-off-by: Mike Turner <mike@provable.com>
Signed-off-by: Mike Turner <mike@provable.com>
Rename `kind` to `type` and `RecordMatcher` to `RecordFieldFilter`. Reframe
the permission model as additive: `programs` and `decryptPermission` are
preserved exactly, with `recordAccess` and `viewKeyExposure` as new opt-in
fields. Drop `anyProgram` level. Document backward-compatibility guarantees,
interaction rules, and validation failure modes.
Make readAddress optional with default true. Add an Address exposure
subsection covering all four address-leakage surfaces (connect return,
_publicKey getter, init handler, plaintext-bearing methods) and their
behavior under readAddress: false. Document the decryptPermission:
NoDecrypt-only constraint and the deliberate signMessage leak.
Adds the dapp-facing types and signature changes from
docs/adapter-privacy-extension.md.

aleo-types: new InputRequest, RecordFilters, RecordFieldFilter,
TransactionInput types with isLiteralInput / hasInputRequest helpers.
TransactionOptions.inputs widens from string[] to TransactionInput[].

aleo-wallet-standard: new ConnectOptions, RecordAccessGrant, ProgramGrant,
RecordGrant, FieldGrant (with readAccess), ViewKeyExposure, plus a
hasUnsupportedConnectOptions helper. ConnectFeature.connect and
WalletAdapterProps.connect accept an optional fourth options argument.

aleo-wallet-adaptor/core: BaseAleoWalletAdapter.connect accepts options,
enforces the readAddress: false / decryptPermission: NoDecrypt precondition,
tracks _readAddress, and short-circuits decrypt, requestRecords,
transitionViewKeys, requestTransactionHistory under address withholding.
New error classes: WalletInputRequestNotSupportedError,
WalletConnectOptionsNotSupportedError, WalletAddressWithheldError. The new
types are re-exported from core for dapp ergonomics.

Wallet adapters: leo, fox, soter, puzzle widen connect with options? and
throw WalletConnectOptionsNotSupportedError when any of the new options are
set; their executeTransaction throws WalletInputRequestNotSupportedError
when any input is an InputRequest. Shield forwards options to the
extension and tolerates an empty address under readAddress: false.

react: AleoWalletProvider accepts new optional props recordAccess,
viewKeyExposure, readAddress and forwards them on every adapter.connect
call. Dependency arrays updated.

Doc: clarified that Account.address returns "" (empty string) under
readAddress: false rather than null, and that FieldGrant.readAccess
controls plaintext exposure independently of filterability.
Implement wallet-specified record inputs and address permission grants
@vercel

vercel Bot commented May 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aleo-dev-toolkit-documentation Ready Ready Preview, Comment Jun 2, 2026 10:28am
aleo-dev-toolkit-react-app Ready Ready Preview, Comment Jun 2, 2026 10:28am

Request Review

Drops the type: "viewKey" InputRequest variant and the
viewKeyExposure ConnectOptions field across the type packages,
wallet adapter, React provider, example app, docs, and changeset.

The separate transitionViewKeys feature is unrelated and unchanged.
…lues

Adds a fourth `InputRequest` variant `{ type: "derived", algorithm, args }`
that asks the wallet to run a named cryptographic algorithm over its own
state (view key, wallet-maintained counters, etc.) plus dapp-supplied args,
and substitutes the result into a transaction input slot. The dapp never
observes the wallet-side inputs — only the output.

Strict opt-in via a new `algorithmsAllowed?: AlgorithmGrant[]` field on
`ConnectOptions`: each grant authorizes exactly one
`(algorithm, program, function, inputPosition)` call site, all four fields
required and exact-match. The wallet refuses every derived request whose
tuple is not present. No broad default.

A new `algorithmsSupported(): Promise<string[]>` adapter method lets dapps
discover what a wallet implements before populating the allowlist.
Wallets without derived-input support return `[]` (default) and connections
with non-empty `algorithmsAllowed` throw `WalletConnectOptionsNotSupportedError`
via the existing `hasUnsupportedConnectOptions` path.

Inaugural algorithm: `program-scoped-address-blind`. Inputs: `{ "domain-separator": field }`.
Output: `address`. Valid slot positions: `address`, `group`, `scalar`, `field`.

Updates the PrivateInputs example with a fourth `Derived` mode on primitive
slots whose baseType is in an algorithm's `validSlotTypes`, plus a
connect-time `AlgorithmGrant[]` editor with an "Auto-grant this function's
eligible slots" convenience button. The grant JSON preview now includes
`algorithmsAllowed`.

See docs/adapter-privacy-extension.md §"Derived inputs" for the spec and
docs/dapp-privacy-quickstart.md for an implementor's guide.
Derived inputs: wallet-computed cryptographic values

@emmaprice082 emmaprice082 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to support DEX will be applied to this PR from @iamalwaysuncomfortable as per this slack conversation: https://provablehq.slack.com/archives/C09BJ3FRADU/p1779990449495799

…ved-input form

buildInputs now omits blank optional args (so issue-mode works without a
targetAddress) and the arg form renders possibleValues (e.g. mode) as a select
instead of a free-text field with a misleading numeric-literal placeholder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants